Why do I get AttributeError: 'NoneType' object has no attribute 'something'